package com.hanrt.mrhighlevel.sort1;


import org.apache.hadoop.io.WritableComparator;

/**
 * 对于基本的数据类型,默认就是升序,不需要自定义比较器。
 * 所以如果是降序的比较器就需要自定义
 */
public class MyDescComparator extends WritableComparator{
	
	@Override
    public int compare(byte[] b1, int s1, int l1,
                       byte[] b2, int s2, int l2) {
      long thisValue = readLong(b1, s1);
      long thatValue = readLong(b2, s2);
      return (thisValue<thatValue ? 1 : (thisValue==thatValue ? 0 : -1));
    }

}
